package org.example.seata.bs.auth.handler.check;

import lombok.extern.slf4j.Slf4j;
import org.example.seata.bs.auth.handler.code.AbstractSendCodeHandler;
import org.example.seata.common.security.constant.AuthTypeConst;
import org.springframework.stereotype.Component;

/**
 * 手机号码验证码登录检验
 *
 * @author hzq
 * @date 2021/12/10 14:43
 */
@Slf4j
@Component
public class PhoneCheckAuthHandler extends AbstractCheckAuthHandler {

    @Override
    public boolean supportType(String checkType) {
        return AuthTypeConst.PHONE.equals(checkType);
    }

    @Override
    protected Object getCode(String principal) {
        return valueOperations.get(AbstractSendCodeHandler.generateKey(principal, AuthTypeConst.PHONE));
    }
}
